package graph.main;

import java.util.Set;

import graph.Edge;
import graph.Graph;
import graph.Node;
import graph.transform.GMLTransformer;

public class Main {
	public static void main(String[] args) {
		System.out.printf("Sleiv Mixer%n");
		ico();
		tetra();
		hexa();
		octa();
		dodeca();
	}

	private static void dodeca() {
		Graph graph = new Graph();
		GMLTransformer t = new GMLTransformer(graph);
		Set<Edge> a = t.ring(t.newNode(5));
		Set<Node> b = t.addChild(1);
		Set<Edge> c = t.ring(b);
		Set<Node> d = t.replaceMiddle(c);
		Set<Node> e = t.addChild(d,1);
		t.connectIfDistance(e, 4);
		System.out.printf("dodeca:%s%n", graph);
	}

	private static void octa() {
		Graph graph = new Graph();
		GMLTransformer t = new GMLTransformer(graph);
		Set<Edge> a = t.ring(t.newNode(3));
		Set<Node> b = t.addMiddle(a);
		t.ring(b);
		System.out.printf("%s%n", graph);
	}

	private static void tetra() {
		Graph graph = new Graph();
		GMLTransformer t = new GMLTransformer(graph);
		t.ring(t.addChild(t.newNode(), 3));
		System.out.printf("%s%n", graph);
	}
	private static void hexa() {
		Graph graph = new Graph();
		GMLTransformer t = new GMLTransformer(graph);
		t.ring(t.newNode(4));
		t.ring(t.addChild(1));
		System.out.printf("%s%n", graph);
	}

	private static void ico() {
		Graph graph = new Graph();
		GMLTransformer t = new GMLTransformer(graph);
		Set<Edge> e = t.ring(t.addChild(t.newNode(), 5));
		Set<Node> n = t.addMiddle(e);
		t.connectIfDistance(n, 2);
		t.connect(t.newNode(), n);
		System.out.printf("%s%n", graph);
	}
}
